<?php echo $this->completion(1, $this->project->name); ?>
<div class="usvn_info">
	<h1><?php echo $this->project->name;?></h1>
	<p><?php echo $this->project->description;?><br /><br />
<?php echo sprintf(T_("Checkout URL : %s"), '<a href="' . $this->subversion_url . '">' . $this->subversion_url . '</a>');?>
</p>
</div>
<div class="usvn_info">
	<?php if ($this->isAdmin) : ?>
		<form style="float: right; text-align: right;" action="<?php echo $this->url(array("action" => "adduser")); ?>" method="post">
			<div>
				<table>
					<tr>
						<td>
							<?php echo $this->formText("users_login", null, array("onkeyup" => "javascript:ajax_completion(1, 'completion', 'users_login', event)", "autocomplete" => "off", "onkeyDown" => "javascript:geretouche(event, 'completion', 'users_login')", "onfocus" => "javascript:ajax_completion(1, 'completion', 'users_login', event)", "onblur" => "setTimeout('document.getElementById(\\'completion\\').style.visibility=\\'hidden\\';', 200)")); ?>
						</td>
						<td>
							<?php echo $this->formSubmit("adduser", T_("Add")); ?>
						</td>
					</tr>
					<tr>
						<td>
							<div id="completion" class="_list_autocomplete_ajax" style="visibility:hidden"></div>
						</td>
						<td>
						</td>
					</tr>
				</table>
			</div>
		</form>
	<?php endif; ?>

	<h1><?php echo T_("Admins users");?></h1>
	<ul>
		<?php foreach ($this->project->findManyToManyRowset("USVN_Db_Table_Users", "USVN_Db_Table_UsersToProjects") as $user) :?>
			<li>
				<?php if ($this->isAdmin) : ?>
					<?php echo $this->urlConfirm(array("action" => "deleteuser", "users_id" => $user->id), $this->img("delete.png", T_("Delete")),
					sprintf(T_("Do you really want to remove user %s as admin of project %s?"), $user->login, $this->project->name));
					?>
				<?php endif; ?>
				<?php echo $user->login; ?>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<div class="usvn_info">
	<?php if ($this->isAdmin) : ?>
		<form style="float: right; text-align: right;" action="<?php echo $this->url(array("action" => "addgroup")); ?>" method="post">
			<div>
				<table>
					<tr><td>
						<?php echo $this->formText("groups_name", null, array("onkeyup" => "javascript:ajax_completion(2, 'completion1', 'groups_name', event)", "autocomplete" => "off", "onkeyDown" => "javascript:geretouche(event, 'completion1', 'groups_name')", "onfocus" => "javascript:ajax_completion(2, 'completion1', 'groups_name', event)", "onblur" => "setTimeout('document.getElementById(\\'completion1\\').style.visibility=\\'hidden\\';', 200)")); ?>
					</td><td>
						<?php echo $this->formSubmit("addgroup", T_("Add")); ?>
					</td></tr>
					<tr><td><div id="completion1" class="_list_autocomplete_ajax" style="visibility:hidden"></div></td><td></td></tr>
				</table>
			</div>
		</form>
	<?php endif; ?>

	<h1><?php echo T_("Affected groups");?></h1>
	<ul>
		<?php foreach ($this->project->findManyToManyRowset("USVN_Db_Table_Groups", "USVN_Db_Table_GroupsToProjects") as $group) :?>
			<li>
				<?php if ($this->isAdmin) : ?>
					<?php echo $this->urlConfirm(array("action" => "deletegroup", "groups_id" => $group->id), $this->img("delete.png", T_("Delete")),
					sprintf(T_("Do you really want to remove group %s from project %s?"), $group->name, $this->project->name));
					 ?>
					<?php endif; ?>
				<?php if ($group->hasUser($this->user)) : ?>
					<a href="<?php echo $this->url(array("group" => $group->name), "group"); ?>"><?php echo $group->name; ?></a>
				<?php else : ?>
					<?php echo $group->name; ?>
				<?php endif; ?>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<div class="usvn_info">
	<h1><?php echo T_("Last five commits"); ?>
<?php /*	echo "<link rel='alternate' type='application/rss+xml' href='".$this->url(array("controller" => "rss", "project" => $this->project->name), "rss")."?secret=".$this->secret_id."' />";
	if (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
		echo "  <a href='".$this->url(array("controller" => "rss", "project" => $this->project->name), "rss")."?secret=".$this->secret_id."'>".$this->img('rss.png', T_('Rss'))."</a>"; */
	 ?></h1>
	<table class="sortable">
		<thead>
			<tr>
				<th><?php echo T_("Revision");?></th>
				<th><?php echo T_("Author");?></th>
				<th><?php echo T_("Date");?></th>
				<th><?php echo T_("Message");?></th>
			</tr>
		</thead>
		<tbody>
		<?php foreach (array_keys($this->log) as $revision): ?>
			<?php $commit = $this->log[$revision]; ?>
			<tr onClick="window.location='<?php echo $this->url(array('project' => $this->project->name, 'action' => 'commit', 'commit' => $revision), 'commit'); ?>'">
				<td class="revision"><?php echo $revision ?></td>
				<td class="logname"><?php echo $commit['author'] ?></td>
				<td class="date"><?php echo date("Y-m-d H:i",  $commit["date"]); ?></td>
				<td class="comment"><?php echo USVN_SVNLog::formatComment($commit['msg']); ?></td>
			</tr>
		<?php endforeach; ?>
		</tbody>
	</table>
</div>